package com.it.jzs.controller;

import com.it.jzs.service.BlogUserThumbsService;
import com.it.jzs.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("thumbs")
@CrossOrigin
public class BlogUserThumbsController {

    @Resource
    private BlogUserThumbsService blogUserThumbsService;

    @GetMapping("{id}")  // 根据用户id查出对应的博客
    public Result<Object> selectAllType(@PathVariable("id") Integer id) {
//        System.out.println("id = " + id);
        Result<Object> result = blogUserThumbsService.selectAll(id);
        return result;
    }

    @PutMapping("{id}")  // 根据用户id查出对应的博客 修改点赞的状态
    public Result<Object> update(@PathVariable("id") Integer id) {
        Result<Object> result = blogUserThumbsService.updateFlag(id);
        return result;
    }
}
